Cheetah actions - #47
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces an action-variable layer for Cheetah-backed virtual accelerator PVs, replacing the legacy transformer-based approach and updating tests/CI to exercise the new integration.
Changes:
- Added
virtual_accelerator/cheetah/actions.pyand updatedvirtual_accelerator/cheetah/variables.pyto build PV variables via Cheetah action classes. - Removed the legacy
SLACCheetahTransformerand pared downvirtual_accelerator/cheetah/utils.pyto CSV mapping helpers only. - Expanded/updated tests and CI workflow to cover the new Cheetah action layer and CU_HXR Cheetah model.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| virtual_accelerator/tests/test_optional_dependencies.py | Updates optional-import test to reference the new Cheetah actions module. |
| virtual_accelerator/tests/test_facet.py | Consolidates magnet PV mapping tests via parametrization. |
| virtual_accelerator/tests/test_cu_hxr.py | Adds CU_HXR Cheetah model tests and refactors runtime gating logic. |
| virtual_accelerator/tests/test_cheetah_actions.py | Adds unit tests validating action variable roundtrips and factory instantiation. |
| virtual_accelerator/tests/_bmad_model_test_utils.py | Improves PV roundtrip helper to handle booleans and pneumatic-style toggles. |
| virtual_accelerator/models/cu_hxr.py | Adds get_cu_hxr_cheetah_model() using action_variables integration. |
| virtual_accelerator/cheetah/variables.py | Refactors variable factory to instantiate action-layer variables from YAML mappings. |
| virtual_accelerator/cheetah/utils.py | Removes old attribute-mapping logic; keeps only CSV mapping utilities. |
| virtual_accelerator/cheetah/transformer.py | Deletes legacy SLACCheetahTransformer. |
| virtual_accelerator/cheetah/actions.py | Introduces action-variable implementations (magnets, BPMs, cavities, screens). |
| pyproject.toml | Switches lume-base dependency to PyPI release instead of Git URL. |
| examples/cheetah_model_example.ipynb | Updates example usage to new model API patterns and parameters. |
| .github/workflows/test-cheetah.yml | Runs the new Cheetah action tests and CU_HXR Cheetah subset in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…accelerator into cheetah-actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new Cheetah action layer for the virtual accelerator, removes the old custom transformer, updates dependency management to use PyPI releases instead of direct GitHub links, and improves Cheetah-related test coverage. The most important changes are summarized below.
Cheetah Action Layer Implementation:
virtual_accelerator/cheetah/actions.pymodule implementing Cheetah-backed action-variable classes for magnets, cavities, screens, and other devices, with proper unit conversions and read-only/read-write semantics. This centralizes and standardizes Cheetah PV behavior in the codebase.Codebase Simplification:
virtual_accelerator/cheetah/transformer.pyfile, eliminating custom mapping logic in favor of the new action layer.Dependency Management:
pyproject.tomlto use PyPI packages forlume-base,lume-bmad,lume-cheetah,lume-torch, anddistgendependencies instead of direct GitHub links, improving reproducibility and installation reliability. [1] [2] [3]Testing Improvements:
.github/workflows/test-cheetah.ymlto includetest_cheetah_actions.pyand Cheetah-specific tests fromtest_cu_hxr.py, ensuring better coverage of the new action layer.Example Notebook Updates:
examples/cheetah_model_example.ipynbfor improved usage clarity, including specifyingn_particlesin model construction, simplifying image retrieval, and correcting the Python version metadata. [1] [2] [3]These changes modernize the Cheetah integration, streamline maintenance, and improve testability and reproducibility.